package com.leetcode.根据算法进行分类.数学定理相关;

/**
 * @author: xiaomi
 * @date: 2021/4/10
 * @description: 263. 丑数
 * https://leetcode-cn.com/problems/ugly-number/
 */
public class A_263_丑数 {
    static A_263_丑数 action = new A_263_丑数();

    public static void main(String[] args) {
        test1();
        test2();
        test3();
    }

    static void test1() {
        //

        //System.out.println("res = " + res);
    }

    static void test2() {
        //

        //System.out.println("res = " + res);
    }

    static void test3() {
        //

        //System.out.println("res = " + res);
    }

    /**
     * 只包含2,3,5
     *
     * @param n
     * @return
     */
    public boolean isUgly(int n) {
        if (n == 1) {
            return true;
        }
        if (n <= 0) {
            return false;
        }
        while (n != 1) {
            int temp = (n % 10);
            if ((temp & 1) == 0) {
                //如果是偶数
                n = n >> 1;
            } else if (temp == 0 || temp == 5) {
                n = n / 5;
            } else if (n % 3 == 0) {
                n = n / 3;
            } else {
                return false;
            }
        }
        return true;
    }
}
